using System.Collections.Generic;
using UnityEngine;

public class PakageSettingsListsHolder : ScriptableObject
{
	public int allCoinsCount;

	public int allCoinsCollected;

	public List<PakageSettingsList> allLevelsPakageLists;

	public void RefreshAllCoins()
	{
		allCoinsCount = 0;
		allCoinsCollected = 0;
		foreach (PakageSettingsList allLevelsPakageList in allLevelsPakageLists)
		{
			if (!(allLevelsPakageList != null))
			{
				continue;
			}
			foreach (PakageSettings packageSettings in allLevelsPakageList.packageSettingsList)
			{
				if (packageSettings.PakageType == HidenPakageType.Coins)
				{
					allCoinsCount++;
					if (IsCollected(allLevelsPakageList.levelNme, packageSettings))
					{
						allCoinsCollected++;
					}
				}
			}
		}
	}

	public bool IsCollected(string levelName, PakageSettings pakageSettings)
	{
		string key = string.Concat(levelName, " ", pakageSettings.PakageType, " ", pakageSettings.PakageIndex);
		return BCWStorage.Get<bool>(key);
	}
}
